import connection from "@/app/database";
import { addHandle, deleteHandle, listHandle, updateHandle } from "@/utils/sql";
import { ResultSetHeader, RowDataPacket } from "mysql2";

class Menu {
  async add(menu_item: API.menuItem) {
    return await addHandle<API.menuItem>(menu_item, "menu");
  }
  async delete(ids: number[]) {
    return await deleteHandle(ids, "menu");
  }
  async update(menu_item: API.menuItem) {
    return await updateHandle<API.menuItem>(menu_item, "menu");
  }
  async getList(search: API.menuList): Promise<API.ResponseApi<API.menuItem>> {
    return await listHandle<API.menuList, API.menuItem>(search, "menu");
  }
}

export default new Menu();
